Skip to content

feat(agc): report which trace threads dropped events and where their buffers filled - #5813

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
eliyarson:trace-drop-detail
Oct 14, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
eliyarson:trace-drop-detail

Conversation

@eliyarson

@eliyarson eliyarson commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

Refs #5786. Depends on #5808, which adds APS5_TRACE_EVENTS; this branch is #5808's commit plus one commit, and only the second is new here.

trace_dropped says that a trace lost data, but not which thread, from when, or whether the summary numbers are affected. When it is true, the summary line now also carries trace_dropped_threads, one entry per affected thread name:

  • events_full_after_s: seconds from the window's first present to the start of the first lost slice. Absent for gpu, and absent whenever that slice starts outside the line's span of presents.
  • events_lost: slices not recorded (absent when 0). In APS5_TRACE_SUMMARY_EVERY lines it counts the buffer's losses since it started.
  • totals_full: the thread's totals table overflowed, so the summary numbers are incomplete. A thread with only events_lost has complete totals.

Threads that share a name, such as the shader prepare threads, share one entry: losses are summed, the earliest fill is kept, and totals_full is true if any of them is.

The Chrome trace gets a trace buffer full instant event on the thread where its buffer filled.

trace_dropped is set on the same conditions as before, and when nothing drops the output is byte-identical. #5808's parser, bounds and buffer sizes are unchanged; sizing the shader prepare buffers from APS5_TRACE_EVENTS is left for a follow-up after #5808 lands.

Overlap: #5046 edits the same lines of PerformanceTrace.hpp; whichever lands second needs a rebase. #4969 and #5453 also touch docs/dev/BUILD.md, different sections.

Tested

Linux x86-64 (CachyOS, kernel 7.2.2), RTX 3080 Ti, NVIDIA 610.57.04.

  • agc_performance_trace (new cases: per-thread entries, same-named threads merged, the interval-line bounds of events_full_after_s, lost-event counts, totals overflow, the buffer-full event), ctest -R '^agc_|trace' on feat(agc): configure trace event buffers #5808's head 1effd67b7 plus this commit (518 tests, all pass except agc_driver_stencil_ref_export, skipped as on main), tools/check_conventions.py.

  • Hades II, title screen, APS5_TRACE_SECONDS=150:30, on the earlier revision of this PR (its own capacity setting instead of feat(agc): configure trace event buffers #5808's; the drop reporting is the same apart from the merge by name):

    • default buffer: "trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":27.47,"events_lost":24059,"totals_full":false}}, and the trace buffer full marker sits at that point of the queue-0 track.
    • APS5_TRACE_EVENTS=4194304: "trace_dropped":false, no trace_dropped_threads, queue-0 track recorded to the end of the window (293,343 slices).

    The title screen fills the buffer late; in the hub (trace: the queue-0 worker fills its 262,144-event buffer in about 3 s, so a 30 s window keeps only its first tenth, and trace_dropped doesn't say which thread or when #5786) the default buffer fills after about 3.3 s.

  • Not tested: Windows, other GPUs; no game run on the rebased branch.

Checklist

  • Based on feat(agc): configure trace event buffers #5808, which is based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: feat(agc): configure trace event buffers #5808
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 Ti, driver 610.57.04, Linux (CachyOS)
  • AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor

I found an overlapping open PR: #5808 also adds APS5_TRACE_EVENTS to PerformanceTrace.hpp, but sets a different max and does not size the shader-prepare buffer. Your PR includes both the capacity setting and the drop diagnostics. Please coordinate with Ondra97 on which branch should carry the common capacity/parser behavior, and declare a dependency or rebase the second branch as appropriate.

@eliyarson

Copy link
Copy Markdown
Contributor Author

Thanks @MarcZX100. I've agreed with #5808 that it carries APS5_TRACE_EVENTS; I'm rebasing this PR on top of it so it only adds the per-thread drop details and marker, and will mark it Depends on #5808 once pushed.

@eliyarson eliyarson changed the title feat(agc): report which trace threads dropped events and size their buffers with APS5_TRACE_EVENTS feat(agc): report which trace threads dropped events and where their buffers filled Oct 14, 2026
@adriadam10 adriadam10 self-assigned this Oct 14, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on current main: the only conflict was adjacency in tests/PerformanceTrace.cpp (BatchIds from #5046 next to FullBufferEvents); I kept both and rebased onto main (this branch still carries #5808's commit, so it lands after #5808). agc_performance_trace passes on the rebased tree, the new cases fail to build without the change, and lost/firstLost are published safely (first loss time stored before the release store of the count). The BUILD.md text matches the code. Merging once #5808 is in and the full Build is green.

…buffers filled

The trace summary line keeps `trace_dropped` as before: true when any
thread lost a slice, any thread's totals table was full, or the gpu
track was full. When it is true, the line now also carries
`trace_dropped_threads`, one entry per affected thread name, so the reader
can tell which thread lost data and how much. Threads that share a
name, such as the shader prepare threads, share one entry: losses are
summed, the earliest fill is kept and totals_full is true if any is.

Each entry has `events_full_after_s`, the seconds from the first
present of the window to the start of the first lost slice. It is
absent for `gpu` and in every summary line (windowed frames/seconds
and APS5_TRACE_SUMMARY_EVERY) whenever the first lost slice starts
outside the line's span of presents, including a slice whose scope
began before the window opened or one lost after the last present.
`events_lost` is the number of slices not recorded and is absent when
0; in interval lines it counts the buffer's losses since it started.
`totals_full` is true when the thread's totals table overflowed, which
makes the summary numbers incomplete; a thread with only `events_lost`
has complete totals.

The Chrome trace gets a `trace buffer full` instant event on a thread
at the point where its buffer filled.

BUILD.md documents the new fields and the event.

`trace_dropped` is unchanged, and when nothing drops the default output
is byte-identical to before.

Refs boykopovar#5786
Depends on boykopovar#5808
@adriadam10

Copy link
Copy Markdown
Collaborator

#5808 is merged, and this branch conflicted with main again; I rebased it, which dropped #5808's commit and left only this one. agc_performance_trace passes on the rebased tree, the new cases fail to build without the change, and lost/firstLost are published safely (first loss time stored before the release store of the count). The BUILD.md text matches the code. Merging once the full Build is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants